<?php

class Error {
	const ERROR_MP_DEFAULT = ERROR_MP_DEFAULT;
	const ERROR_CMIUP_DEFAULT = ERROR_CMIUP_DEFAULT;
	const ERROR_AUTH_NOTLOGINED = ERROR_CMIUP_DEFAULT;
	const ERROR_SMS_SEND = ERROR_SMS_SEND;
	const ERROR_USER_PARAMS_LOST = 100000000;
	static function getErrorByMpErrorNo($mpErrorNo) {
		$arr = array(
			'333'	=> ERROR_MP_DEFAULT,
			'999'	=> ERROR_MP_DATABASE_ERROR,
		);
		return array_key_exists($mpErrorNo, $arr) ? $arr[$mpErrorNo] : "mperror:$mpErrorNo";
		//return array_key_exists($mpErrorNo, $arr) ? $arr[$mpErrorNo] : ERROR_MP_DEFAULT;
	}
	static function getErrorByCmiupErrorNo($cmiupErrorNo) {
		$arr = array(
			'222'	=> ERROR_CMIUP_NETWORK_ERROR,
			'333'	=> ERROR_CMIUP_DATABASE_ERROR,
			'999'	=> ERROR_CMIUP_DEFAULT,
			'1001'	=> ERROR_CMIUP_REG_MAIL_EXISTS,
			'1002'	=> ERROR_CMIUP_REG_MOBILE_EXISTS,
			'1003'	=> ERROR_CMIUP_LOGIN_MOBILE_NOT_EXISTS,
			'1004'	=> ERROR_CMIUP_LOGIN_MAIL_NOT_EXISTS,
			'1005'	=> ERROR_CMIUP_LOGIN_PASSWD_WRONG,
			'1006'	=> ERROR_CMIUP_LOGIN_NO_PARAM_LOGINTYPE,
			'1007'	=> ERROR_CMIUP_LOGIN_NO_PARAM_USER,
			'1008'	=> ERROR_CMIUP_LOGIN_NO_PARAM_PASS,
			'1009'	=> ERROR_CMIUP_REQ_NO_UID,
			'1010'	=> ERROR_CMIUP_REQ_PROV_WRONG,
			'1011'	=> ERROR_CMIUP_REQ_CLIENTID_WRONG,//?
			'1012'	=> ERROR_CMIUP_REQ_MOBILE_WRONG,
			'1013'	=> ERROR_CMIUP_REQ_EMAIL_WRONG,
			'1014'	=> ERROR_CMIUP_REQ_UID_NOT_EXIST,
			'1015'	=> ERROR_CMIUP_LOGIN_LOGINTYPE_WRONG,
			'1016'	=> ERROR_CMIUP_LOGIN_ACCOUNT_EMPTY,
			'1017'	=> ERROR_CMIUP_REQ_CLIENTID_WRONG,
			'1018'	=> ERROR_CMIUP_RSTPASS_TYPE_WRONG,
			'1019'	=> ERROR_CMIUP_RSTPASS_NO_NEWPASS,
			'1020'	=> ERROR_CMIUP_RSTPASS_NEWPASS_NOTFIX,
			'1021'	=> ERROR_CMIUP_NO_NAME,
			'1022'	=> ERROR_CMIUP_LOGIN_NO_MOBILE,
			'1023'	=> ERROR_CMIUP_LOGIN_NO_EMAIL,
			'1026'	=> ERROR_CMIUP_LOGIN_NOT_ACTIVED,
			'1034'	=> ERROR_CMIUP_MOBILETOPROV_NO_PROV,
			'1035'	=> ERROR_CMIUP_MOBILETOPROV_NO_MOBILE,
			'1040'	=> ERROR_CMIUP_LOGIN_WEAK_PASSWD,
			'1041'	=> ERROR_CMIUP_LOGIN_RUDE,
			'1042'	=> ERROR_CMIUP_LOGIN_RUDE,
			'1043'	=> ERROR_CMIUP_LOGIN_PASSWDMD5_EMPTY,
			'1044'	=> ERROR_CMIUP_LOGIN_NEED_DYNAMIC,
			'1098'	=> ERROR_CMIUP_LOGIN_USER_DESTROYED,
			'1104'	=> ERROR_CMIUP_LOGIN_NOT_SEND_DYNAMIC,
			'1115'	=> ERROR_CMIUP_LOGIN_TOKEN_EXPIRED,
			'1116'	=> ERROR_CMIUP_LOGIN_DYNAMIC_TOOMANY,
			'1147'	=> ERROR_CMIUP_LOGIN_DYNAMIC_TOOMANY,
			'1202'	=> ERROR_CMIUP_REG_SMSCODE_ERROR,
			'1212'	=> ERROR_CMIUP_RSTPASS_SMSCODE_ERROR,
		);
		return array_key_exists($cmiupErrorNo, $arr) ? $arr[$cmiupErrorNo] : ERROR_CMIUP_DEFAULT;
	}
}

